package com.intelligencesoft.pss.entity.listeners;

import java.util.Date;

import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

import com.intelligencesoft.pss.entity.BasePojo;

public class AutoUpdate {
	@PrePersist
	@PreUpdate
	public void beforeSave(Object entity) {
		if (entity instanceof BasePojo) {
			BasePojo model = (BasePojo) entity;
			String createUser = "admin";
			model.setCreateUser(createUser);
			model.setCreateDate(new Date());
		}
	}

//	@PostPersist
//	public void afterSave(Object entity) {
//	}
//
//	@PreUpdate
//	public void beforeUpdate(Object entity) {
//	}
}
